ostree.git
6 years agoMerge pull request #2030 from jlebon/pr/2020.3
OpenShift Merge Robot [Sat, 14 Mar 2020 15:17:21 +0000 (16:17 +0100)]
Merge pull request #2030 from jlebon/pr/2020.3

Release 2020.3

6 years agoPost-release version bump
Jonathan Lebon [Sat, 14 Mar 2020 01:56:14 +0000 (21:56 -0400)]
Post-release version bump

6 years agoRelease 2020.3
Jonathan Lebon [Sat, 14 Mar 2020 01:54:21 +0000 (21:54 -0400)]
Release 2020.3

Let's do another release to get the `sysroot.readonly` fixes into FCOS
and unpin ostree and rpm-ostree there.

6 years agoMerge pull request #2027 from cgwalters/pull-auto-mnt-namespace
OpenShift Merge Robot [Sat, 14 Mar 2020 01:52:43 +0000 (02:52 +0100)]
Merge pull request #2027 from cgwalters/pull-auto-mnt-namespace

main: Also automatically remount rw /sysroot for `ostree pull` etc.

6 years agomain: Also automatically remount rw /sysroot for `ostree pull` etc.
Colin Walters [Thu, 12 Mar 2020 21:10:29 +0000 (21:10 +0000)]
main: Also automatically remount rw /sysroot for `ostree pull` etc.

See https://github.com/coreos/fedora-coreos-tracker/issues/343
When we added the read-only sysroot support it broke using "raw"
`ostree pull` and `ostree refs --create` and all of the core repo
CLIs that just operate on a repo and not a sysroot.

Fixing this is a bit ugly as it "layer crosses" things even more.
Extract a helper function that works in both cases.

6 years agoMerge pull request #2029 from jlebon/pr/upgrade-tests
OpenShift Merge Robot [Fri, 13 Mar 2020 20:53:04 +0000 (21:53 +0100)]
Merge pull request #2029 from jlebon/pr/upgrade-tests

ci: use `fcosKola` for running kola tests

6 years agoci: use `fcosKola` for running kola tests
Jonathan Lebon [Fri, 13 Mar 2020 18:35:53 +0000 (14:35 -0400)]
ci: use `fcosKola` for running kola tests

We were using `--no-test-exit-error` for upgrade tests but weren't
actually checking for test failures after.

Instead of running kola directly, just use the `fcosKola` custom step
which automatically takes care of e.g. running tests in parallel and
archiving results.

6 years agoMerge pull request #2028 from cgwalters/ci-test-upgrades
OpenShift Merge Robot [Fri, 13 Mar 2020 18:18:40 +0000 (19:18 +0100)]
Merge pull request #2028 from cgwalters/ci-test-upgrades

ci: Test kola --upgrades

6 years agoci: Test kola --upgrades
Colin Walters [Fri, 13 Mar 2020 17:29:58 +0000 (17:29 +0000)]
ci: Test kola --upgrades

This one is very relevant for ostree.

6 years agoMerge pull request #2018 from jlebon/pr/migrate-to-coreos-ci
OpenShift Merge Robot [Wed, 4 Mar 2020 22:32:56 +0000 (17:32 -0500)]
Merge pull request #2018 from jlebon/pr/migrate-to-coreos-ci

ci: migrate to new coreos-ci project

6 years agoci: migrate to new coreos-ci project
Jonathan Lebon [Mon, 2 Mar 2020 19:22:14 +0000 (14:22 -0500)]
ci: migrate to new coreos-ci project

Use the new custom steps. I think we could simplify things further by
using `fcosBuild` but let's start with this for now.

6 years agoMerge pull request #2015 from cgwalters/release
OpenShift Merge Robot [Fri, 21 Feb 2020 15:16:50 +0000 (10:16 -0500)]
Merge pull request #2015 from cgwalters/release

Release 2020.2

6 years agoPost-release version bump
Colin Walters [Fri, 21 Feb 2020 14:48:00 +0000 (14:48 +0000)]
Post-release version bump

6 years agoRelease 2020.2
Colin Walters [Fri, 21 Feb 2020 14:39:14 +0000 (14:39 +0000)]
Release 2020.2

"Brown paper bag" release that actually sets the
`is_release_build=yes` flag and also fixes the
`Since:` on a few new functions.

6 years agoMerge pull request #2014 from ostreedev/fixup-since-versions
OpenShift Merge Robot [Thu, 20 Feb 2020 23:27:28 +0000 (18:27 -0500)]
Merge pull request #2014 from ostreedev/fixup-since-versions

lib: Fix Since versions for 2020.1

6 years agolib: Fix Since versions for 2020.1
Dan Nicholson [Thu, 20 Feb 2020 22:44:51 +0000 (15:44 -0700)]
lib: Fix Since versions for 2020.1

These had been added assuming 2019.7 would be the next version, but now
it's 2020 and there's been a release. In the case of
`OstreeCommitSizesEntry`, I'd forgotten to move it forward from 2019.5
to 2019.7 in the time between when I started working on the feature and
it landed.

6 years agoMerge pull request #2013 from cgwalters/prepareroot-comment
OpenShift Merge Robot [Thu, 20 Feb 2020 17:30:05 +0000 (18:30 +0100)]
Merge pull request #2013 from cgwalters/prepareroot-comment

prepare-root: Add a comment about the role of this service

6 years agoPost-release version bump
Colin Walters [Thu, 20 Feb 2020 16:37:07 +0000 (16:37 +0000)]
Post-release version bump

6 years agoRelease 2020.1
Colin Walters [Thu, 20 Feb 2020 16:16:19 +0000 (16:16 +0000)]
Release 2020.1

New year, new release!

6 years agoMerge pull request #1984 from jlebon/pr/supp-groups
OpenShift Merge Robot [Thu, 20 Feb 2020 02:07:41 +0000 (03:07 +0100)]
Merge pull request #1984 from jlebon/pr/supp-groups

lib/repo: Create repo directories as 0775

6 years agoprepare-root: Add a comment about the role of this service
Colin Walters [Thu, 20 Feb 2020 00:33:01 +0000 (00:33 +0000)]
prepare-root: Add a comment about the role of this service

Came up on an IRC question, docs for this are scattered around.

6 years agoMerge pull request #2012 from clime/patch-2
OpenShift Merge Robot [Wed, 19 Feb 2020 19:32:23 +0000 (20:32 +0100)]
Merge pull request #2012 from clime/patch-2

Update ostree-pull.xml with info about pulled refs location and access

6 years agoUpdate ostree-pull.xml with info about pulled refs location and access
clime [Tue, 18 Feb 2020 20:46:22 +0000 (21:46 +0100)]
Update ostree-pull.xml with info about pulled refs location and access

6 years agolib/repo: Create repo directories as 0775
Jonathan Lebon [Thu, 12 Dec 2019 21:40:33 +0000 (16:40 -0500)]
lib/repo: Create repo directories as 0775

For repo structure directories like `objects`, `refs`, etc... we should
be more permissive and let the system's `umask` narrow down the
permission bits as wanted.

This came up in a context where we want to be able to have read/write
access on an OSTree repo on NFS from two separate OpenShift apps by
using supplemental groups[1] so we don't require SCCs for running as the
same UID (supplemental groups are part of the default restricted SCC).

[1] https://docs.openshift.com/container-platform/3.11/install_config/persistent_storage/persistent_storage_nfs.html#nfs-supplemental-groups

6 years agoMerge pull request #2009 from cgwalters/testsuite
OpenShift Merge Robot [Fri, 14 Feb 2020 21:56:25 +0000 (22:56 +0100)]
Merge pull request #2009 from cgwalters/testsuite

deploy: Avoid trying to change immutable state unnecessarily

6 years agodeploy: Avoid trying to change immutable state unnecessarily
Colin Walters [Fri, 14 Feb 2020 16:35:50 +0000 (16:35 +0000)]
deploy: Avoid trying to change immutable state unnecessarily

For some reason I haven't fully debugged (probably a recent
kernel change), in the case where the immutable bit isn't set,
trying to call `EXT2_IOC_SETFLAGS` without it set returns `EINVAL`.

Let's avoid calling the `ioctl()` if we don't have anything to do.

This fixes a slew of `make check` failures here in my toolbox
environment.

(kernel is `5.5.0-0.rc6.git0.1.fc32.x86_64` with `xfs`)

6 years agoMerge pull request #2003 from crobinso/doc-link-fix
OpenShift Merge Robot [Mon, 10 Feb 2020 19:28:40 +0000 (20:28 +0100)]
Merge pull request #2003 from crobinso/doc-link-fix

docs: Fix 'package layering' rpm-ostree link

6 years agodocs: Fix 'package layering' rpm-ostree link
Cole Robinson [Mon, 10 Feb 2020 19:00:11 +0000 (14:00 -0500)]
docs: Fix 'package layering' rpm-ostree link

Signed-off-by: Cole Robinson <crobinso@redhat.com>
6 years agoMerge pull request #1999 from cgwalters/cci-2
OpenShift Merge Robot [Fri, 7 Feb 2020 14:08:05 +0000 (15:08 +0100)]
Merge pull request #1999 from cgwalters/cci-2

ci: Replace PAPR with CoreOS CI

6 years agoci: Replace PAPR with CoreOS CI
Colin Walters [Mon, 3 Feb 2020 20:45:07 +0000 (20:45 +0000)]
ci: Replace PAPR with CoreOS CI

Move the alternative builds into the Jenkinsfile.

Update it to do a FCOS build + kola run.

We drop the flatpak/rpm-ostree runs for now; the former
will needs some work to do the automatic virt bits.  The
latter I think we can circle back to when we e.g. figure
out how to include rpm-ostree's tests in kola runs.

6 years agoMerge pull request #2000 from cgwalters/soup-travis
OpenShift Merge Robot [Mon, 3 Feb 2020 21:56:55 +0000 (13:56 -0800)]
Merge pull request #2000 from cgwalters/soup-travis

travis: Update debian/ubuntu environments

6 years agotravis: Update debian/ubuntu environments
Colin Walters [Mon, 3 Feb 2020 21:03:17 +0000 (21:03 +0000)]
travis: Update debian/ubuntu environments

There are new major LTS environments out; bump up to the latest
for each and drop the old Ubuntu trusty.  Part of cleaning up
our CI.

6 years agoMerge pull request #1998 from cgwalters/cci-jenkinsfile
OpenShift Merge Robot [Mon, 3 Feb 2020 18:42:55 +0000 (10:42 -0800)]
Merge pull request #1998 from cgwalters/cci-jenkinsfile

Add .cci.jenkinsfile

6 years agoAdd .cci.jenkinsfile
Colin Walters [Mon, 3 Feb 2020 15:42:28 +0000 (15:42 +0000)]
Add .cci.jenkinsfile

See https://github.com/jlebon/coreos-ci

This is just a start to test, cut down from the rpm-ostree version.

6 years agoMerge pull request #1959 from cgwalters/ostree-verity
OpenShift Merge Robot [Tue, 28 Jan 2020 21:01:40 +0000 (13:01 -0800)]
Merge pull request #1959 from cgwalters/ostree-verity

Initial fs-verity support

6 years agoMerge pull request #1957 from dbnicholson/commit-sizes
OpenShift Merge Robot [Mon, 27 Jan 2020 16:25:59 +0000 (08:25 -0800)]
Merge pull request #1957 from dbnicholson/commit-sizes

Upstream Endless sizes metadata changes

6 years agoInitial fs-verity support
Colin Walters [Fri, 25 Oct 2019 22:07:44 +0000 (22:07 +0000)]
Initial fs-verity support

Using fs-verity is natural for OSTree because it's file-based,
as opposed to block based (like dm-verity).  This only covers
files - not symlinks or directories.  And we clearly need to
have integrity for the deployment directories at least.

Also, what we likely need is an API that supports signing files
as they're committed.

So making this truly secure would need a lot more work.  Nevertheless,
I think it's time to start experimenting with it.  Among other things,
it does *finally* add an API that makes files immutable, which will
help against some accidental damage.

This is basic enablement work that is being driven by
Fedora CoreOS; see also https://github.com/coreos/coreos-assembler/pull/876

6 years agoMerge pull request #1877 from dbnicholson/specific-gpg-errors
OpenShift Merge Robot [Sun, 26 Jan 2020 17:20:51 +0000 (09:20 -0800)]
Merge pull request #1877 from dbnicholson/specific-gpg-errors

More specific GPG errors

6 years agoMerge pull request #1996 from akiernan/us-with-systemd
OpenShift Merge Robot [Sun, 26 Jan 2020 12:19:31 +0000 (04:19 -0800)]
Merge pull request #1996 from akiernan/us-with-systemd

build: fix systemd feature advertisement

6 years agobuild: fix systemd feature advertisement
Alex Kiernan [Tue, 21 Jan 2020 12:37:52 +0000 (12:37 +0000)]
build: fix systemd feature advertisement

17db0f15a798 ("configure: add option for libsystemd") exposed
--without-libsystemd to allow systemd to be disabled even if the systemd
pkgconfig script was present, introducing a new variable
with_libsystemd; there are now three, almost identical variables:

- with_libsystemd [yes, no, maybe] - controlled by --without-libsystemd,
  resolved into yes/no by the initial checks
- have_libsystemd [yes, no, <undefined>] - only set if with_libsystemd
  is yes/maybe, otherwise undefined
- with_systemd [yes, <undefined>] - yes if have_systemd is yes,
  otherwise undefined

with_systemd is the earliest variable and was previously set by a set of
checks for dracut and mkinitcpio. These checks were changed for a
systemd check in 9e2763106be0 ("lib: Use sd_journal directly
(optionally)"). This commit also introduced BUILDOPT_LIBSYSTEMD, which
will always match BUILDOPT_SYSTEMD.

Fix the confusion by removing with_systemd which will always be yes when
with_libsystemd=yes, or undefined if with_libsystemd=no. We can ignore
the with_libsystemd=maybe case because it will always be resolved into
yes/no before with_systemd is set.

And replace all uses of BUILDOPT_SYSTEMD with BUILDOPT_LIBSYSTEMD, since
they again always match.

This fixes both the advertised features and the summary output when
systemd is disabled by using with_libsystemd which is always defined.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Fixes: 5c62a7e4d0a5 ("build: Expose systemd in OSTREE_FEATURES")
Fixes: 17db0f15a798 ("configure: add option for libsystemd")
Supersedes: #1992

6 years agoMerge pull request #1948 from dbnicholson/trivial-httpd-autoexit
OpenShift Merge Robot [Fri, 24 Jan 2020 20:42:59 +0000 (12:42 -0800)]
Merge pull request #1948 from dbnicholson/trivial-httpd-autoexit

ostree/trivial-httpd: Fix --autoexit with --daemonize and --log-file

6 years agoostree/trivial-httpd: Add log message for autoexit
Dan Nicholson [Fri, 18 Oct 2019 16:50:39 +0000 (10:50 -0600)]
ostree/trivial-httpd: Add log message for autoexit

This is useful when checking if the daemon actually exited since we
don't store the child PID anywhere.

6 years agoostree/trivial-httpd: Fix --autoexit with --daemonize and --log-file
Dan Nicholson [Fri, 18 Oct 2019 16:33:02 +0000 (10:33 -0600)]
ostree/trivial-httpd: Fix --autoexit with --daemonize and --log-file

When --autoexit is used with --daemonize and --log-file, the program
never exits when the root directory is deleted. I believe what happens
is that g_file_new_for_path triggers the glib worker context to be
started to talk to GVfs. Once the program forks, the parent exits and
the thread iterating the worker context is gone. The file monitor then
never receives any events because the inotify helper also runs from the
worker context.

Move the fork earlier just after parsing and validating the command line
arguments. In order to handle setup errors in the child, a pipe is
opened and the parents waits until the child writes a status byte to it.
If the byte is 0, the parent considers the child setup successful and
exits and the child carries on as a daemon. Notably, the child doesn't
reopen stderr to /dev/null until after this so that it can send error
messages there.

Fixes: #1941
6 years agoci/flatpak: Patch GPG error assertions from OSTree
Dan Nicholson [Tue, 21 Jan 2020 22:47:01 +0000 (15:47 -0700)]
ci/flatpak: Patch GPG error assertions from OSTree

Some of the flatpak tests assert on GPG error strings that come from
OSTree. Those are being changed here, so patch the cloned flatpak 1.4.1
to accommodate the new error strings. When this work lands, I'll send a
patch upstream to flatpak that will eventually trickle back here in a
tagged build.

6 years agotests/gpg: Add tests for importing updated remote GPG keys
Dan Nicholson [Fri, 21 Jun 2019 11:59:56 +0000 (06:59 -0500)]
tests/gpg: Add tests for importing updated remote GPG keys

This checks whether gpg-import will properly update the keyring for a
key that already exists. In particular, we check that changing the key
expiration time or revoking it results in commit verification failure
after re-importing the keys.

6 years agotests/gpg: Test ostree_gpg_verify_result_require_valid_signature
Dan Nicholson [Fri, 21 Jun 2019 11:16:13 +0000 (06:16 -0500)]
tests/gpg: Test ostree_gpg_verify_result_require_valid_signature

Add explicit tests for
`ostree_gpg_verify_result_require_valid_signature` in addition to the
implicit tests via `ostree pull` and others. This allows checking the
error code raised.

6 years agolib/gpg: Add more specific OstreeGpgError codes
Dan Nicholson [Sat, 15 Jun 2019 14:56:44 +0000 (09:56 -0500)]
lib/gpg: Add more specific OstreeGpgError codes

Currently `ostree_gpg_verify_result_require_valid_signature` always
returns an error that the key used for the signature is missing from the
keyring. However, all that's been determined is that there are no valid
signatures. The error could also be from an expired signature, an
expired key, a revoked key or an invalid signature.

Provide values for these missing errors and return them from
`ostree_gpg_verify_result_require_valid_signature`. The description of
each result is appended to the error message, but since the result can
contain more than one signature but only a single error can be returned,
the status of the last signature is used for the error code. See the
comment for rationale.

Related: flatpak/flatpak#1450

6 years agotests/test-gpg-verify-result: Allow specifying signature files
Dan Nicholson [Thu, 20 Jun 2019 14:32:13 +0000 (09:32 -0500)]
tests/test-gpg-verify-result: Allow specifying signature files

Currently tests are always run against the full lgpl2.sig file with all
signatures, but it should also be possible to specify one or more of the
individual lgpgl2.sig<N> files.

Drop the current usage of passing the signature index in the test data
since it's always specific to the test function and instead provide an
optional array of signature files for the test fixture to sign with.

6 years agotests/gpg-verify-data: Empty out trustdb.gpg
Dan Nicholson [Fri, 21 Jun 2019 12:09:43 +0000 (07:09 -0500)]
tests/gpg-verify-data: Empty out trustdb.gpg

When the private keys were generated, gpg added an ultimate trust entry
since you normally want to trust your own keys. However, this throws off
the expired signature testing since gpgme considers it valid if the key
is fully or ultimately trusted.

The use of a trustdb for the test-gpg-verify-result is unlike any other
GPG verification in ostree. Under normal circumstances, a temporary GPG
homedir is created without any trust information, so all keys are
treated as having unknown trust.

Regenerate an empty trustdb.gpg in gpg-verify-data so that the tests
behave as ostree normally operates. After this the expired signature
testing correctly shows up as a non-valid signature. The trustdb was
regenerated by simply removing it and running any gpg operation with the
gpg-verify-data directory as the homedir.

6 years agotests/gpg-verify-data: Split out signature data
Dan Nicholson [Wed, 19 Jun 2019 21:31:18 +0000 (16:31 -0500)]
tests/gpg-verify-data: Split out signature data

The full block with all 5 signatures remains, but this allows passing
individual signatures through the GPG verification APIs. The split was
done with `gpgsplit`, and looking at the output of `gpg --list-packets`
of the split and unsplit files appears correct.

6 years agotests/gpghome: Create revocation certificates for keys
Dan Nicholson [Fri, 21 Jun 2019 11:27:33 +0000 (06:27 -0500)]
tests/gpghome: Create revocation certificates for keys

These can then be imported during a test to revoke a key without trying
to go through the gpg --generate-revocation dialog. Note that these need
to go in a subdirectory of the homedir since `gpgkeypath` will try to
import every regular file in the homedir.

6 years agotests/libtest: Make temporary gpghome private
Dan Nicholson [Wed, 19 Jun 2019 16:51:47 +0000 (11:51 -0500)]
tests/libtest: Make temporary gpghome private

gpg prints a warning about unsafe permissions if the homedir is group or
world readable. This is just noise in the test logs, so appease it by
making the homedir 700.

6 years agotests/libtest: Record long GPG key IDs and fingerprints
Dan Nicholson [Wed, 19 Jun 2019 14:49:32 +0000 (09:49 -0500)]
tests/libtest: Record long GPG key IDs and fingerprints

Use long GPG key IDs as it's safer and matches the format used by gpg
and gpgme. Add the associated fingerprints since these are needed by gpg
when manipulating keys.

6 years agolib/gpg: Prefer declare-and-initialize style
Dan Nicholson [Wed, 19 Jun 2019 18:08:40 +0000 (13:08 -0500)]
lib/gpg: Prefer declare-and-initialize style

As noted in
https://github.com/ostreedev/ostree/pull/1872#discussion_r295408768.

6 years agoMerge pull request #1993 from dbnicholson/f29-rpmostree-fixes
OpenShift Merge Robot [Wed, 22 Jan 2020 14:01:25 +0000 (15:01 +0100)]
Merge pull request #1993 from dbnicholson/f29-rpmostree-fixes

ci/rpmostree: Bump to 2019.4

6 years agoci/rpmostree: Bump to 2019.4
Dan Nicholson [Tue, 21 Jan 2020 21:56:31 +0000 (14:56 -0700)]
ci/rpmostree: Bump to 2019.4

The vmcheck tests in 2019.3 fail because of an SSH control socket issue
on overlayfs. This is fixed in 2019.4[1]. That has some other changes
such as using Python 3 in tests. The package dependencies have been
synced from the rpm-ostree CI for that.

Unfortunately, this is no longer a totally representative test of f29
since it has 2019.3 in updates. But that's the price you pay for
exercising someone else's CI from your own CI.

1. https://github.com/coreos/rpm-ostree/commit/c89f81c1385ef095616b0e7001926572a20057b2

Fixes: #1994
6 years agoMerge pull request #1991 from dbnicholson/test-fixes
OpenShift Merge Robot [Tue, 21 Jan 2020 20:13:02 +0000 (21:13 +0100)]
Merge pull request #1991 from dbnicholson/test-fixes

tests/core: Really pick C.UTF-8 locale

6 years agotests/core: Really pick C.UTF-8 locale
Dan Nicholson [Tue, 21 Jan 2020 17:25:17 +0000 (10:25 -0700)]
tests/core: Really pick C.UTF-8 locale

The case-ignoring regex `^(C|en_US)` will match any locale that starts
with `c`. On my system this is `ca_AD.utf8`, which breaks the test
suite. Instead, use a single regex that includes the joining `.` rather
than 2 separate regexes. This also changes `head` to use the `-n`
option, which has been preferred for at least 10 years in the coreutils
version and is supported by busybox as well.

6 years agobin/show: Add --print-sizes option to show sizes metadata
Dan Nicholson [Thu, 24 Oct 2019 21:21:49 +0000 (15:21 -0600)]
bin/show: Add --print-sizes option to show sizes metadata

Use the new `ostree_commit_get_object_sizes()` API to read the
`ostree.sizes` commit metadata and print a summary.

6 years agocore: Add ostree_commit_get_object_sizes API
Dan Nicholson [Tue, 21 Jan 2020 02:54:00 +0000 (19:54 -0700)]
core: Add ostree_commit_get_object_sizes API

This function parses the object listing in the `ostree.sizes` metadata
and returns an array of `OstreeCommitSizesEntry` structures.

Unfortunately, for reasons I don't understand, the linker wants to
resolve `_ostree_read_varuint64` from `ostree-core.c` even though it's
not used by `test-checksum.c` at all.

6 years agocore: Add OstreeCommitSizesEntry type
Dan Nicholson [Thu, 19 Dec 2019 19:50:46 +0000 (12:50 -0700)]
core: Add OstreeCommitSizesEntry type

This will be used when reading out entries in the `ostree.sizes`
metadata. Each entry corresponds to an object in the metadata array.

6 years agolibarchive: Support commit sizes metadata
Dan Nicholson [Thu, 24 Oct 2019 23:00:33 +0000 (17:00 -0600)]
libarchive: Support commit sizes metadata

Call the helper to set the generate_sizes boolean so that object size
data is stored while writing the mtree.

6 years agolib/commit: Include object type in sizes metadata
John Hiesey [Thu, 24 Oct 2019 15:10:57 +0000 (09:10 -0600)]
lib/commit: Include object type in sizes metadata

Append a byte encoding the OSTree object type for each object in the
metadata. This allows the commit metadata to be fetched and then for the
program to see which objects it already has for an accurate calculation
of which objects need to be downloaded.

This slightly breaks the `ostree.sizes` `ay` metadata entries. However,
it's unlikely anyone was asserting the length of the entries since the
array currently ends in 2 variable length integers. As far as I know,
the only users of the sizes metadata are the ostree test suite and
Endless' eos-updater[1]. The former is updated here and the latter
already expects this format.

1. https://github.com/endlessm/eos-updater/

6 years agotests/sizes: Check duplicate file doesn't add sizes entry
Dan Nicholson [Wed, 23 Oct 2019 15:43:10 +0000 (09:43 -0600)]
tests/sizes: Check duplicate file doesn't add sizes entry

A duplicate file will resolve to the same object, so it shouldn't add
any entries to the sizes metadata.

6 years agotests/sizes: Test that sizes metadata is not reused
Dan Nicholson [Wed, 23 Oct 2019 15:10:06 +0000 (09:10 -0600)]
tests/sizes: Test that sizes metadata is not reused

Ensure that the object sizes hash table is cleared after a commit and
not only when the repo is closed.

6 years agotests/sizes: Test sizes metadata with existing objects
Dan Nicholson [Tue, 22 Oct 2019 21:14:58 +0000 (15:14 -0600)]
tests/sizes: Test sizes metadata with existing objects

Repeat the commit to make sure that the files are enumerated again for
the size metadata.

6 years agolib/commit: Make size entries for existing objects
Dan Nicholson [Wed, 23 Oct 2019 15:28:11 +0000 (09:28 -0600)]
lib/commit: Make size entries for existing objects

If the object was already in the repo then the sizes metadata entry was
skipped. Move the sizes entry creation after the data has been computed
but before the early return for an existing object.

6 years agolib/commit: Fix object sizes metadata for multiple commits
Dan Nicholson [Wed, 23 Oct 2019 15:12:08 +0000 (09:12 -0600)]
lib/commit: Fix object sizes metadata for multiple commits

The object sizes hash table was only being cleared when the repo was
finalized. That means that performing multiple commits while the repo
was open would reuse all the object sizes metadata for each commit.

Clear the hash table when the sizes metadata is setup and when it's
added to a commit. This still does not fix the issue all the way since
it does nothing to prevent the program from constructing multiple
commits simultaneously. To handle that, the object sizes hash table
should be attached to the MutableTree since that has the commit state.
However, the MutableTree is gone when the commit is actually created.
The hash table would have to be transferred to the root file when
writing the MutableTree. That would be an awkward addition to
OstreeRepoFile, though. Add a FIXME to capture that.

6 years agotests/sizes: Improve metadata validation
Dan Nicholson [Tue, 22 Oct 2019 20:59:19 +0000 (14:59 -0600)]
tests/sizes: Improve metadata validation

Ensure all 3 of the checksum, compressed size and uncompressed size are
correct. For repeatable objects, skip xattrs and use canonical
permissions for the commit. For the sizes, read a varint rather than
assuming they will be a single byte. To work around bugs in gjs with
byte array unpacking, manually build the array byte by byte. Split out
some helper functions to use in subsequent tests.

6 years agolib/commit: Only set generate_sizes for archive repos
Dan Nicholson [Wed, 23 Oct 2019 19:05:48 +0000 (13:05 -0600)]
lib/commit: Only set generate_sizes for archive repos

Rather than checking throughout the code, only set the boolean when
appropriate.

6 years agoMerge pull request #1987 from akiernan/us-switchroot-tests
OpenShift Merge Robot [Thu, 16 Jan 2020 15:47:41 +0000 (16:47 +0100)]
Merge pull request #1987 from akiernan/us-switchroot-tests

Skip /var test if running with systemd and libmount

6 years agoMerge pull request #1988 from akiernan/us-switchroot-installed
OpenShift Merge Robot [Tue, 14 Jan 2020 19:30:33 +0000 (20:30 +0100)]
Merge pull request #1988 from akiernan/us-switchroot-installed

test-switchroot.sh: Find ostree-prepare-root in installed tests

6 years agofixup! test-switchroot.sh: Find ostree-prepare-root in installed tests
Alex Kiernan [Mon, 30 Dec 2019 13:28:35 +0000 (13:28 +0000)]
fixup! test-switchroot.sh: Find ostree-prepare-root in installed tests

6 years agotest-switchroot.sh: Find ostree-prepare-root in installed tests
Alex Kiernan [Sun, 29 Dec 2019 12:43:34 +0000 (12:43 +0000)]
test-switchroot.sh: Find ostree-prepare-root in installed tests

When running with installed tests, ostree-prepare-root (probably)
exists in /usr/lib. Add heuristics to look for it based on the directory
we're running from.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agotests: Skip /var test if running with systemd and libmount
Alex Kiernan [Sun, 29 Dec 2019 13:25:24 +0000 (13:25 +0000)]
tests: Skip /var test if running with systemd and libmount

If running with systemd and libmount then /var mounting is deferred for
systemd. Skip the relevant tests in this case as it will always fail.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agobuild: Expose systemd in OSTREE_FEATURES
Alex Kiernan [Sun, 29 Dec 2019 13:23:23 +0000 (13:23 +0000)]
build: Expose systemd in OSTREE_FEATURES

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agotest-switchroot.sh: Exclude /proc from file list
Alex Kiernan [Sun, 29 Dec 2019 12:32:28 +0000 (12:32 +0000)]
test-switchroot.sh: Exclude /proc from file list

Since we're not interested in any file inside /proc, exclude it from the
file listing in our fake root thus avoiding failures when processes die
during our execution and find(1) can't then look inside those
directories.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agoMerge pull request #1767 from cgwalters/sysroot-mnt-namespace
OpenShift Merge Robot [Wed, 11 Dec 2019 20:34:36 +0000 (21:34 +0100)]
Merge pull request #1767 from cgwalters/sysroot-mnt-namespace

Support mounting /sysroot (and /boot) read-only

6 years agoSupport mounting /sysroot (and /boot) read-only
Colin Walters [Wed, 3 Oct 2018 14:57:19 +0000 (14:57 +0000)]
Support mounting /sysroot (and /boot) read-only

We want to support extending the read-only state to cover `/sysroot`
and `/boot`, since conceptually all of the data there should only
be written via libostree.  Or at least for `/boot` should *mostly*
just be written by ostree.

This change needs to be opt-in though to avoid breaking anyone.

Add a `sysroot/readonly` key to the repository config which instructs
`ostree-remount.service` to ensure `/sysroot` is read-only.  This
requires a bit of a dance because `/sysroot` is actually the same
filesystem as `/`; so we make `/etc` a writable bind mount in this case.

We also need to handle `/var` in the "OSTree default" case of a bind
mount; the systemd generator now looks at the writability state of
`/sysroot` and uses that to determine whether it should have the
`var.mount` unit happen before or after `ostree-remount.service.`

Also add an API to instruct the libostree shared library
that the caller has created a new mount namespace.  This way
we can freely remount read-write.

This approach extends upon in a much better way previous work
we did to support remounting `/boot` read-write.

Closes: https://github.com/ostreedev/ostree/issues/1265
6 years agofinalize-staged: Use the core option parsing to load sysroot
Colin Walters [Thu, 5 Sep 2019 00:52:15 +0000 (00:52 +0000)]
finalize-staged: Use the core option parsing to load sysroot

Prep for using the default mount namespace handling there that
will land as part of the read-only `/sysroot` and `/boot` work.
See https://github.com/ostreedev/ostree/issues/1265

6 years agoMerge pull request #1981 from cgwalters/release-2019.6
OpenShift Merge Robot [Mon, 9 Dec 2019 19:26:55 +0000 (14:26 -0500)]
Merge pull request #1981 from cgwalters/release-2019.6

Release 2019.6

6 years agoPost-release version bump
Colin Walters [Mon, 9 Dec 2019 16:18:28 +0000 (16:18 +0000)]
Post-release version bump

6 years agoRelease 2019.6
Colin Walters [Mon, 9 Dec 2019 16:10:50 +0000 (16:10 +0000)]
Release 2019.6

Nothing really big here, but let's get a release out
so some bigger things like ro-sysroot, signing, sizes can
bake in master for a bit.

6 years agoMerge pull request #1221 from cgwalters/pull-basic-auth
OpenShift Merge Robot [Tue, 3 Dec 2019 14:41:08 +0000 (06:41 -0800)]
Merge pull request #1221 from cgwalters/pull-basic-auth

    pull: Add support for basic auth

6 years agopull: Add support for basic auth
Colin Walters [Wed, 27 Sep 2017 02:02:25 +0000 (22:02 -0400)]
pull: Add support for basic auth

This has been requested a few times for people delivering
OSTree content and wanting to do access control.

6 years agoMerge pull request #1980 from ssssam/sam/readme-buildstream-tweak
OpenShift Merge Robot [Mon, 2 Dec 2019 13:10:18 +0000 (14:10 +0100)]
Merge pull request #1980 from ssssam/sam/readme-buildstream-tweak

README.md: Tweak text about BuildStream

6 years agoREADME.md: Tweak text about BuildStream
Sam Thursfield [Sun, 1 Dec 2019 19:43:14 +0000 (20:43 +0100)]
README.md: Tweak text about BuildStream

BuildStream no longer uses libostree internally (see
https://gitlab.com/BuildStream/buildstream/issues/387). It still
has first class support for interoperating with libostree repos.

6 years agoMerge pull request #1978 from agners/fix-build-race
OpenShift Merge Robot [Tue, 26 Nov 2019 12:52:25 +0000 (13:52 +0100)]
Merge pull request #1978 from agners/fix-build-race

Avoid race condition when building outside of source tree

6 years agoAvoid race condition when building outside of source tree
Stefan Agner [Tue, 26 Nov 2019 08:20:30 +0000 (09:20 +0100)]
Avoid race condition when building outside of source tree

When building outside of source tree it can happen that src/ostree/
does not exist (yet) when bison is called. This leads to an build
error like so:
  bison: src/ostree/parse-datetime.c: cannot open: No such file or directory

Make sure that src/ostree/ exists when parse-datetime.c is built.

6 years agoMerge pull request #1976 from cgwalters/repo-finder-test
OpenShift Merge Robot [Mon, 25 Nov 2019 14:26:31 +0000 (15:26 +0100)]
Merge pull request #1976 from cgwalters/repo-finder-test

tests/repo-finder: Run realpath() on /tmp

6 years agotests/repo-finder: Run realpath() on /tmp
Colin Walters [Thu, 21 Nov 2019 18:37:48 +0000 (18:37 +0000)]
tests/repo-finder: Run realpath() on /tmp

This fixes running this test case inside
https://github.com/cgwalters/coretoolbox

6 years agoMerge pull request #1968 from ptomato/ostree-async-progress-copy-state
OpenShift Merge Robot [Thu, 21 Nov 2019 14:14:04 +0000 (15:14 +0100)]
Merge pull request #1968 from ptomato/ostree-async-progress-copy-state

libostree: Add ostree_async_progress_copy_state()

6 years agolibostree: Add ostree_async_progress_copy_state()
Philip Chimento [Mon, 4 Nov 2019 21:21:36 +0000 (13:21 -0800)]
libostree: Add ostree_async_progress_copy_state()

This allows copying the state from one OstreeAsyncProgress object to
another, atomically, without invoking the callback. This is needed in
libflatpak, in order to chain OstreeAsyncProgress objects so that you
can still receive progress updates when iterating a different
GMainContext than the one that the OstreeAsyncProgress object was
created under.

See https://github.com/flatpak/flatpak/pull/3211 for the application of
this API.

6 years agoBump version in symbols file
Philip Chimento [Tue, 5 Nov 2019 18:05:45 +0000 (10:05 -0800)]
Bump version in symbols file

There were no new symbols in 2019.5 and this version didn't get bumped
when 2019.5 was released.

6 years agoMerge pull request #1909 from rfairley/rfairley-kargs-order-entries
OpenShift Merge Robot [Fri, 8 Nov 2019 22:54:12 +0000 (23:54 +0100)]
Merge pull request #1909 from rfairley/rfairley-kargs-order-entries

lib/kernel-args: Store kernel args as key/value entries

6 years agoMerge pull request #1971 from akiernan/us-tests-dir
OpenShift Merge Robot [Fri, 8 Nov 2019 16:08:15 +0000 (17:08 +0100)]
Merge pull request #1971 from akiernan/us-tests-dir

build: create tests directory for split builds

6 years agoMerge pull request #1972 from cgwalters/bump-libglnx-20191108
OpenShift Merge Robot [Fri, 8 Nov 2019 15:26:47 +0000 (16:26 +0100)]
Merge pull request #1972 from cgwalters/bump-libglnx-20191108

Bump libglnx

6 years agoBump libglnx
Colin Walters [Fri, 8 Nov 2019 13:36:23 +0000 (13:36 +0000)]
Bump libglnx

This has a few fixes, mainly I want to get this in
as prep for fs-verity.

Update submodule: libglnx

```
Alex Kiernan (1):
      macros: Add TEMP_FAILURE_RETRY for musl

Alexander Larsson (1):
      Add glnx_open_anonymous_tmpfile_full() allowing you to specify the directory

Colin Walters (8):
      Merge branch 'shutil-rm-rf-errprefix' into 'master'
      Merge branch 'us-temp-failure-retry' into 'master'
      Merge branch 'anonymous-tmpfile-dir' into 'master'
      Merge branch 'meson-older-compilers' into 'master'
      fdio: Add glnx_tmpfile_reopen_rdonly()
      Merge branch 'reopen-rdonly' into 'master'
      build-sys: Add libglnx-testlib.c to Automake
      Merge branch 'testlib-automake' into 'master'

Jonathan Lebon (1):
      Merge branch 'uchar' into 'master'

Simon McVittie (5):
      missing: Remove unused <uchar.h>
      Run the fdio test in its own temporary directory
      meson: Define HAVE_DECL_FOO to 0 if foo isn't declared
      Make the Meson build work on older compilers
      CI: Target a Fedora stable release

Will Thompson (3):
      Add meson.build files
      Document using this as a Meson subproject
      Add GitLab CI

```

6 years agobuild: create tests directory for split builds
Alex Kiernan [Tue, 5 Nov 2019 22:26:23 +0000 (22:26 +0000)]
build: create tests directory for split builds

When `--disable-dependency-tracking` is in effect with separate build
directory, the tests directory isn't created as a result of the
dependency generation, which leads to a build race for the tests
directory being created and failures:

  Making all in .
  make[2]: Entering directory 'TOPDIR/build/tmp/work/riscv64-yoe-linux-musl/ostree/2019.5-r0/build'
  (echo '[Test]' > tests/test-local-pull-depth.sh.test.tmp; \
  echo 'Type=session' >> tests/test-local-pull-depth.sh.test.tmp; \
  echo 'Exec=env G_TEST_SRCDIR=/usr/libexec/installed-tests/libostree G_TEST_BUILDDIR=/usr/libexec/installed-tests/libostree /usr/libexec/installed-tests/libostree/test-local-pull-depth.sh' >> tests/test-local-pull-depth.sh.test.tmp; \
  mv tests/test-local-pull-depth.sh.test.tmp tests/test-local-pull-depth.sh.test)
  /bin/sh: tests/test-local-pull-depth.sh.test.tmp: No such file or directory
  /bin/sh: line 1: tests/test-local-pull-depth.sh.test.tmp: No such file or directory
  /bin/sh: line 2: tests/test-local-pull-depth.sh.test.tmp: No such file or directory
  mv: cannot stat 'tests/test-local-pull-depth.sh.test.tmp': No such file or directory
  make[2]: *** [Makefile:9282: tests/test-local-pull-depth.sh.test] Error 1

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
6 years agolib/kernel-args: Store kernel args as key/value entries
Robert Fairley [Thu, 29 Aug 2019 16:14:26 +0000 (12:14 -0400)]
lib/kernel-args: Store kernel args as key/value entries

Define an `OstreeKernelArgsEntry` structure, which holds
both the key and the value. The kargs order array stores
entries for each key/value pair, instead of just the keys.
The hash table is used to locate entries, by storing
entries in a pointer array for each key. The same public
interface is preserved, while maintaining ordering
information of each key/value pair when
appending/replacing/deleting kargs.

Fixes: #1859